package org.je.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil
{
	private static final SimpleDateFormat	format	= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	/**
	 * @param str
	 * @return date
	 */
	public static Date parse(String str){
		try {
			str = str.indexOf(" ") == -1 ? str + " 00:00:00" : str;
			return format.parse(str);
		} catch (ParseException e) {
			throw new RuntimeException("parse-date-error:"+str);
		}
	}
	/**
	 * @param date
	 * @return str
	 */
	public static String fromat(Date date){
		return format.format(date);
	}
}
